<template>
  <div class="welfare-service">
    <div class="container pad-30">
      <!-- 上面的头 -->
      <FloorHeader
        :title="$t('welfareService')"
        :link="$t('moreBenefits')"/>
      <!-- 主要内容 -->
      <div class="main-container">
        <!-- 宣传栏 -->
        <Swiper class="conduct" :showArrow="false">
          <SwiperItem v-for="(item, index) in data.bannerList" :key="index">
            <img :src="item.picUrl" alt="宣传栏">
          </SwiperItem>
        </Swiper>
        <!-- 商品列表 -->
        <div class="product-list" v-for="item in data.indexModuleVO" :key="item.id" v-if="item.type === 2">
          <div class="title">
            {{ item.title }}
            <span class="all">查看全部 &gt;</span>
          </div>
          <!-- 商品列表 -->
          <div class="product" v-for="goods in item.itemList" :key="goods.id">
            <img :src="goods.listPicUrl" :alt="goods.name" :title="goods.simpleDesc">
            <div class="product-detail">
              <div class="goods-name">{{ goods.name }}</div>
              <div class="time-limit-price">限时价<span>{{ $t('priceSymbol') }}{{ goods.retailPrice }}</span></div>
              <div class="cost-price">{{ $t('priceSymbol') }}{{ goods.counterPrice }}</div>
              <button class="btn-buy">立即抢购</button>
            </div>
            <!-- 折扣 -->
            <div class="discount">
              <span class="number">{{ goods.disCount }}</span>折
            </div>
          </div>
        </div>
        <!-- 量贩等 -->
        <div class="wholesale">
          <div class="content" v-for="item in data.indexModuleVO" :key="item.id" v-if="item.type !== 2">
            <div class="title">
              {{ item.title }}
              <span class="all">全部 &gt;</span>
            </div>
            <!-- 商品 -->
            <div class="product" v-for="(goods, index) in item.itemList" :key="goods.id" v-if="index < 2">
              <img :src="goods.listPicUrl" :alt="goods.name" :title="goods.simpleDesc">
              <div class="product-detail">
                <div class="goods-name">{{ goods.name }}</div>
                <div class="price">
                  <span class="time-limit-price">{{ $t('priceSymbol') }}{{ goods.retailPrice }}</span>
                  <span class="cost-price">
                    {{ $t('priceSymbol') }}{{ goods.counterPrice }}
                    <i class="iconfont icon-gouwuche2"></i>
                  </span>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import FloorHeader from './FloorHeader'

export default {
  props: {
    data: {
      type: Object,
      default: () => {}
    }
  },
  components: {
    FloorHeader
  }
}
</script>

<style lang="less" scoped>
@import "./../../styles/variable";
@import "./../../styles/common";

.welfare-service {
  background: @bg-lightgrey;
  padding: 30px 0;
  .main-container {
    background: @write;
    display: flex;
    height: 376px;
    .conduct {
      width: 224px;
      height: 100%;
      img {
        width: 100%;
        height: 100%;
      }
    }
    .product-list {
      flex: 1;
      padding: 0px 16px;
      .title {
        align-items: center;
        border-bottom: 1px solid @bg-lightgrey;
        display: flex;
        font-size: 16px;
        justify-content: space-between;
        padding: 18px 0px 12px;
        margin-bottom: 20px;
        .all {
          color: @font-color-grey;
          cursor: pointer;
          font-size: 12px;
        }
      }
      .product {
        display: flex;
        float: left;
        width: 50%;
        padding: 0px 10px 20px 0px;
        position: relative;
        img {
          width: 130px;
          height: 130px;
        }
        .product-detail {
          flex: 1;
          padding-left: 10px;
          .goods-name {
            color: @font-color;
            cursor: pointer;
            font-size: 14px;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
            margin-top: 8px;
            &:hover {
              color: @font-color-golden;
            }
          }
          .time-limit-price {
            color: @font-color-red;
            font-size: 14px;
            span {
              font-size: 20px;
              font-weight: 700;
            }
          }
          .cost-price {
            color: @font-color-light;
            margin-top: 2px;
            text-decoration: line-through;
          }
          .btn-buy {
            font-size: 12px;
            width: 90px;
            margin-top: 0px;
            height: 28px;
          }
        }
        .discount {
          background-color: @font-color-orange;
          border-radius: 100%;
          bottom: 10px;
          color: @write;
          font-size: 12px;
          position: absolute;
          left: 80px;
          width: 38px;
          height: 38px;
          text-align: center;
          line-height: 38px;
          top: 80px;
          .number {
            font-size: 16px;
          }
        }
      }
    }
    .wholesale {
      border-left: 1px solid @bg-lightgrey;
      width: 242px;
      height: 100%;
      padding: 0px 20px;
      .content {
        overflow: hidden;
        width: 100%;
        .title {
          align-items: center;
          display: flex;
          font-size: 16px;
          justify-content: space-between;
          padding: 18px 0px 13px;
          .all {
            color: @font-color-grey;
            cursor: pointer;
            font-size: 12px;
          }
        }
        .product {
          display: flex;
          float: left;
          padding-bottom: 20px;
          width: 100%;
          img {
            width: 50px;
            height: 50px;
          }
          .product-detail {
            flex: 1;
            padding-left: 10px;
            .goods-name {
              color: @font-color;
              cursor: pointer;
              font-size: 14px;
              text-overflow: ellipsis;
              white-space: nowrap;
              overflow: hidden;
              margin: 4px 0 14px;
              &:hover {
                color: @font-color-golden;
              }
            }
            .price {
              font-size: 14px;
              position: relative;
              .time-limit-price {
                color: @font-color-red;
              }
              .cost-price {
                color: @font-color-light;
                margin-top: 2px;
                text-decoration: line-through;
              }
              .iconfont {
                bottom: 0px;
                color: @font-color-golden;
                font-size: 22px;
                width: 24px;
                height: 24px;
                right: 2px;
                position: absolute;
              }
            }
          }
          .discount {
            background-color: @font-color-orange;
            border-radius: 100%;
            bottom: 10px;
            color: @write;
            font-size: 12px;
            position: absolute;
            left: 80px;
            width: 38px;
            height: 38px;
            text-align: center;
            line-height: 38px;
            top: 80px;
            .number {
              font-size: 16px;
            }
          }
        }

      }
    }
  }
}
</style>
